package com.hxkj.service;

import com.github.pagehelper.PageInfo;
import com.hxkj.domain.po.*;
import com.platform.common.domain.result.ResultDataStruct;
import com.platform.common.domain.result.ResultMessageStruct;
import com.platform.common.domain.to.PageTo;

import java.util.List;
import java.util.Map;

/**
 * Created by hunter on 2018/5/19.
 */
public interface AuthUserService {

    /**
    * @author Mr.zheng
    * @Description getAuthUserBySlave 从从数据库获取符合条件的用户列表,定时刷新缓存
    * @Date 15:43 2018/5/19
    * @Param [authUser] 用户信息
    * @return com.github.pagehelper.PageInfo 用户列表
    **/
  //  @Cached(name="getAuthUserBySlave", key="#authUser.authUserId", expire = 3600,cacheType = CacheType.REMOTE)
   // @CacheRefresh(refresh = 1800, stopRefreshAfterLastAccess = 3600, timeUnit = TimeUnit.SECONDS)
    PageInfo getAuthUserBySlave(AuthUser authUser, PageTo pageParam) throws Exception;

    /**
    * @author Mr.zheng
    * @Description getAuthUser 根据用户ID获取用户信息
    * @Date 15:44 2018/5/19
    * @Param [uid] 用户ID
    * @return com.hxkj.domain.po.User 用户信息
    **/
  //  @Cached(name="authUserCache", key="#authUserId", expire = 3600,cacheType = CacheType.REMOTE)
    ResultDataStruct<AllocationAuthUser> getAuthUser(Long uid) throws Exception;

    /**
    * @author Mr.zheng
    * @Description saveAuthUser 新增用户
    * @Date 15:45 2018/5/19
    * @Param [authUser] 用户信息
    * @return void
    **/
    ResultMessageStruct saveAuthUser(AuthUser authUser) throws Exception;



    /**
     * 用户锁示例
     *
     * @param uid
     * @throws Exception
     */
    void userLock(String uid) throws Exception;


    /**
    * @author Mr.zheng
    * @Description updateAuthUser 更新用户信息
    * @Date 9:58 2018/5/21
    * @Param [uid]
    * @return com.platform.common.domain.result.ResultDataStruct
    **/
  //  @CacheUpdate(name="authUserCache.", key="#authUser.authUserId", value="#authUser")
    ResultMessageStruct updateAuthUser(AuthUser authUser) throws Exception;

    /**
    * @author Mr.zheng
    * @Description deleteAuthUser 删除用户信息
    * @Date 11:23 2018/5/21
    * @Param [authUser]
    * @return com.platform.common.domain.result.ResultMessageStruct
    **/
  //  @CacheInvalidate(name="authUserCache.", key="#authUser.authUserId")
    ResultMessageStruct deleteAuthUser(AuthUser authUser) throws Exception;

    /**
     * 查找用户对应的角色
     */

    List<AuthRole> findAuthRoleByUser(AuthUser authUser) throws Exception;



    /**
     * 给用户赋予角色
     */
    ResultMessageStruct addUsertToRole(AuthRole authRole) throws Exception;

    /**
     * 查找所有关联和未关联角色的用户
     * @param authRole
     * @return
     * @throws Exception
     */

    ResultDataStruct<AllocationUser> getRoleAssignUser(AuthRole authRole) throws Exception;




    /**
     * 获取所有拥有自媒体角色的用户id集合
     * @param authUserAgent
     * @return
     * @throws Exception
     */
    public PageInfo<AuthUserAgent> getAgentList(AuthUserAgent authUserAgent, PageTo pageParam) throws Exception;


    /**
    * @author Mr.zheng
    * @Description getAuthRoleByUser 根据用户信息获取角色信息
    * @Date 9:02 2018/6/14
    * @Param [authUser]
    * @return com.platform.common.domain.result.ResultDataStruct<com.hxkj.domain.po.AuthRole>
    **/
    ResultDataStruct<AuthRole> getAuthRoleByUser(AuthUser authUser)throws Exception;

    /**
    * @author Mr.zheng
    * @Description getSiteById 根据站点ID去获取站点信息
    * @Date 17:00 2018/6/14
    * @Param [site]
    * @return com.platform.common.domain.result.ResultDataStruct<com.hxkj.domain.po.Site>
    **/
    ResultDataStruct<Site> getSiteById(Site site)throws Exception;

    /**
    * @author Mr.zheng
    * @Description updateAuthUserPassword 用户修改密码
    * @Date 15:32 2018/6/26
    * @Param [authUser]
    * @return com.platform.common.domain.result.ResultMessageStruct
    **/
    ResultMessageStruct updateAuthUserPassword(AuthUser authUser);
}
